<template>
	<w-container :loading="loading">
		<view class="pa-16">
			<view class="bg-color-white br-12 pa-12 flex flex-ai-start">
				<w-image :src="info.admin_avatar" :width="40" :height="40" :radius="40"></w-image>
				<view class="flex flex-dir-col ml-12">
					<view class="font-w-500 mb-4">{{ info.title }}</view>
					<view style="color: #757575;" class="font-size-13">{{ info.content }}</view>
					<view class="flex flex-ai-center flex-w mt-12" style="gap: 20rpx;">
						<w-image @click.native.stop="bigImage(info.images,i)" v-for="(p,i) in info.images && info.images.split(',')" :key="i" :src="p" :width="80" :height="80" radius="8"></w-image>
					</view>
					<view class="flex flex-ai-center mt-12 flex-js-sb w-100">
						<view class="font-color-666 font-size-12">{{ info.create_time|formatDate }}</view>
						<view @click.stop="shareInfo(info)" class="flex flex-ai-center">
							<w-icon class="share"></w-icon>
							<view class="font-color-666 font-size-12">分享</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</w-container>
</template>

<script>
	
	import {
		getRumorDetails
	} from '@/api/notice/index.js'
	export default {
		data() {
			return {
				id:'',
				info:{},
				loading:true
			}
		},
		onLoad({id = ''}) {
			this.id = id
			this.getInfo()
		},
		methods: {
			async getInfo(){
				const { data,code } = await getRumorDetails(this.id)
				if(code != 1) return
				uni.setNavigationBarTitle({
					title:data.title
				})
				this.info = data
				this.loading = false
			},
			bigImage(URLS,I){
				let urls = URLS.split(',')
				urls = urls.map(item => this.$ossUrl + item)
				uni.previewImage({
					urls,
					current:I
				})
			},
			shareInfo(info){
				uni.setClipboardData({
					data:`${this.$ossUrl}/#/pages/superSpeak/detail?id=${info.id}`
				})
			}
		}
	}
</script>

<style>

</style>
